package com.bilicute.libman.pojo;

import com.bilicute.libman.annotate.Identity;
import com.bilicute.libman.annotate.UserStatus;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.annotation.Validated;

/**
 * @所属包名: com.bilicute.libman.pojo
 * @类名: User
 * @作者: i囡漫笔
 * @描述: 用户实体类
 * @创建时间: 2024-06-18 09:16
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Validated
public class User {
    private Integer user_id;
    @Pattern(regexp ="^\\S{5,16}$" , message = "用户名长度不符合规则5-16\n")
    @NotNull(message = "用户名为空")
    @NotBlank(message = "用户名为空")
    private String user_name;
    @Pattern(regexp ="^\\S{5,16}$" , message = "密码长度不符合规则5-16\n")
    @NotNull(message = "密码为空")
    @NotBlank(message = "密码为空")
    @JsonIgnore
    private String user_password;
    @NotBlank(message = "邮箱为空")
    @Pattern(regexp = "^[\\da-zA-Z_-]+@[\\da-zA-Z_-]+\\.(com|cn|email)$", message = "邮箱输入错误或为不支持的邮箱")
    @Email
    private String user_email;
    @Identity(message = "用户身份不正确")
    private String user_role;
    @UserStatus(message = "用户状态不正确")
    private String user_status;
}
